<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goodsList-edit" th:object="${goodsList}">
            <input id="goodsId" name="goodsId" th:field="*{goodsId}"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">物品排序：</label>
                <div class="col-sm-8">
                    <input id="goodsSort" name="goodsSort" th:field="*{goodsSort}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">物品编号：</label>
                <div class="col-sm-8">
                    <input id="goodsNumber" name="goodsNumber" th:field="*{goodsNumber}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">物品名称：</label>
                <div class="col-sm-8">
                    <input id="goodsName" name="goodsName" th:field="*{goodsName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">类别：</label>
				<div class="col-sm-8">
					<select id="sortId" name="sortId" class="form-control select2-hidden-accessible" >
						<option th:each="goodsSort:${goodsSorts}" th:value="${goodsSort.sortId}" th:text="${goodsSort.sortName}" th:field="*{sortId}" th:disabled="${goodsSort.status == '1'}"></option>
					</select>
				</div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">单位：</label>
				<div class="col-sm-8">
					<select id="goodsUnit" name="goodsUnit" class="form-control m-b" th:with="type=${@dict.getType('unit_list')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	                </select>
				</div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
                </div>
            </div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script th:src="@{/ajax/libs/select/select2.js}"></script>
    <script type="text/javascript">
		var prefix = ctx + "store/goodsList"
		$("#form-goodsList-edit").validate({
			rules:{
				goodsNumber:{
					required:true,
				},
				goodsName:{
        			required:true,
        		},
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/edit", $('#form-goodsList-edit').serialize());
			}
		});
		
		// h所有修改，光标默认定位在第1个输入框
		var oldVal=$('input:eq(1)').val();
		$('input:eq(1)').val("").focus().val(oldVal);
	</script>
</body>
</html>
